<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/pages/common/header.jsp"%>
</head>
<body>
    <div class="contentBody contentborder">
        <div class="tab-pane" id="tabPane">
            <div id="message">${message }</div>
            <div class="tab-page">
                 <h1 class="tab">采购单选择</h1>
                 <div class="contentborder">
                     <jdf:form bean="request" scope="request">
                        <form action="${dynamicDomain}/purchase/${action}?ajax=1" method="post">
                             <table class="inputTable">
                                <tr>
                                    <td nowrap class="label cancelBorderLeft">
                                        <label for="search_EQI_objectId">编号：</label>
                                    </td>
                                    <td class="content">
                                        <input type="text" name="search_EQI_objectId" />
                                    </td>
                                    <td nowrap class="label">
                                        <label for="search_GED_purchaseDate">采购日期：</label>
                                    </td>
                                    <td class="content">
                                        <input type="text" id="search_GED_purchaseDate" size="12" name="search_GED_purchaseDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'search_LED_purchaseDate\')}',readOnly:true})">
                                        ~
                                        <input type="text" id="search_LED_purchaseDate" size="12" name="search_LED_purchaseDate" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'search_GED_purchaseDate\')}',readOnly:true})">
                                    </td>
                                </tr>
                                <tr>
                                    <td class="bottomLabel" nowrap colspan="4">
                                        <div class="right">
                                            <button type="reset">重置</button>
                                            <button type="submit">查询</button>
                                        </div>
                                    </td>
                             </table>
                        </form>
                    </jdf:form>
                </div>
                <div class="contentborder listArea">
                    <div class="toolBar">
                        <button type="button" onclick="javascript:select();">确认</button>
                    </div>
                    <div id="tableDiv">
                        <jdf:table items="items" var="currentRowObject" retrieveRowsCallback="limit" filterRowsCallback="limit" sortRowsCallback="limit" action="${action}?ajax=1">
                            <jdf:export view="csv" fileName="订单.csv" tooltip="Export CSV" imageName="csv" />
                            <jdf:export view="xls" fileName="订单.xls" tooltip="Export EXCEL" imageName="xls" />
                            <jdf:row>
                                <jdf:column property="id" title="<input type='checkbox' class='noBorder' name='pchk' onclick='pchkClick()'" style="width: 5%;text-align: center;padding: 0" sortable="false">
                                    <script>
                                        document.write("<input type='checkbox' class='noBorder' name='schk' value='${currentRowObject.objectId}' onclick='schkClick()'>")
                                    </script>
                                </jdf:column>
                                <jdf:column property="purchaseNo" title="编号" style="width: 10%" />
                                <jdf:column property="purchaseDate" title="采购日期" style="width: 10%" cell="date"/>
                                <jdf:column property="total" title="总计" style="width: 10%" cell="currency"/>
                                <jdf:column property="supplierId" title="供应商" style="width: 10%">
                                    <jdf:columnCollectionValue items="suppliers" nameProperty="name" value="${currentRowObject.supplierId}" />
                                </jdf:column>
                                <jdf:column property="currency" title="币种" style="width: 5%">
                                    <jdf:columnValue dictionaryId="1006" value="${currentRowObject.currency}"/>
                                </jdf:column>
                            </jdf:row>
                        </jdf:table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function select(){
           var supplierId = getCheckedValuesString(document.getElementsByName("schk"));
           if(supplierId==null){
               showMessage("请至少选择一个采购单",60000);
               return;
           }else{
               parent.$("#supplierId").val(supplierId).change();
               parent.$("#supplierNo").val("");
               parent.jQuery.fn.colorbox.close();
           }
        }
    </script>
</body>
</html>